// 列表区域可以线上i所有的物料
// key对应的组件映射关系
import {ElButton, ElInput} from 'element-plus'
function createEditorConfig(){
  const componentList = []; // 物料表
  const componentMap = {}; // 物料表的映射关系

  return {
    
    componentList,
    componentMap,
    register: (component) => {
      componentList.push(component)
      componentMap[component.key] = component

    }
  }
}

export let registerConfig = createEditorConfig()
registerConfig.register({
  label:'W文本',
  key:'text',
  preview: () =>  '预览按钮' ,
  render: () =>    '渲染文本',
})

registerConfig.register({
  label:'按钮',
  key:'button',
  preview: () => <ElButton>预览按钮</ElButton>,
  render: () =>   <ElButton>渲染文本</ElButton>,
})

registerConfig.register({
  label:'输入框',
  key:'input',
  preview: () => <ElInput>输入框</ElInput>,
  render: () =>  <ElInput></ElInput>,
})
